const Koa = require('koa')
const server = require('koa-static')


let app = new Koa()

app.use(server(__dirname + '/static'))

app.use((ctx, next) => {
    if (ctx.path.includes('/user')) {
        ctx.body = { name: 'xm', age: 23 }
    }
    next()
})

const fs = require('fs')
const path = require('path')
const sourceMap = require('source-map')
app.use( async(ctx, next) => {
    if (ctx.path === '/sourcemap') {
        ctx.body =  { name: 'xm', age: 23 }
    }else{
        next()
    }
})

app.listen(3000, () => {
    console.log('http://localhost:3000')
})
